package cn.cntv.app.ipanda.dao.impl;

import com.android.volley.Request;
import com.android.volley.RequestQueue;
import com.android.volley.toolbox.Volley;
import cn.cntv.app.ipanda.application.MainApplication;
import cn.cntv.app.ipanda.dao.HttpDao;

/**
 * @author Xiao JinLai
 * @Date 2015-12-09 14:41
 * @Description: Http 请求添加类，负责请求添加与 Volley 交互
 */
public class HttpDaoImpl implements HttpDao {

    private static HttpDaoImpl ourInstance = new HttpDaoImpl();

    public static HttpDaoImpl getInstance() {
        return ourInstance;
    }

    private RequestQueue mQueue;

    private HttpDaoImpl() {

        mQueue = Volley.newRequestQueue(MainApplication.getApplication());
    }

    /**
     * 添加 Http 请求
     * @param request
     */
    @Override
    public void addRequest(Request request) {

        mQueue.add(request);
    }
}
